#ifndef SERVER_H
#define SERVER_H

#include <QObject>

#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>


class Server : public QObject
{
    Q_OBJECT
public:
    explicit Server(QObject *parent = nullptr);
    void listening();
    void accepting();
    void stopAccept();

private:
    const int PORT = 8888;
    const int MAX_BACKLOG = 20;
    int m_serverFd;
    QAtomicInt m_runningFlag;


signals:
    void serverStatus(int status);
    void acceptStatus(int clientFd);
};

#endif // SERVER_H
